package com.pxxy.toturial.entity;

import java.io.Serializable;
import java.util.Objects;

/******************
 * @Author yejf
 * @Description TODO
 */
public class Computer implements Serializable {

    public Computer() {
        System.out.println("Computer空参构器");
    }
    public void init() {
        System.out.println("init method invoked...");
    }

    public void desctroy() {
        System.out.println("destroy method invoked....");
    }

    public Computer(Integer id, String brand, Double price, Host host) {
        this.id = id;
        this.brand = brand;
        this.price = price;
        this.host = host;
    }

    private Integer id;

    private String brand; //品牌

    private Double price; //价格

    private Host host; //主机

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("Computer{");
        sb.append("id=").append(id);
        sb.append(", brand='").append(brand).append('\'');
        sb.append(", price=").append(price);
        sb.append(", host=").append(host);
        sb.append('}');
        return sb.toString();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Computer computer = (Computer) o;
        return Objects.equals(id, computer.id) &&
                Objects.equals(brand, computer.brand);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, brand);
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public Host getHost() {
        return host;
    }

    public void setHost(Host host) {
        this.host = host;
    }
}
